let v = new Vue({
    el:'#main-container',
    data:function () {
        return {
            settings:{
                data:{
                    simpleData: {
                        enable:true,
                        pIdKey:'parentId'
                    }
                },
                callback:{
                    onClick:this.onClick,
                    // beforeEditName:this.beforeEditName
                },
                view:{
                    // fontCss:this.fontCss
                    // addHoverDom:this.addHoverDom,
                    // removeHoverDom:this.removeHoverDom
                },
                // edit:{
                //     enable: true
                // },
            },
            nodes:[],
        }
    },
    methods:{
        initTree:function () {
            axios({
                url:'manager/area/list',
                method: 'get'
            }).then(resp => {
                this.nodes = resp.data.obj;
                this.nodes[this.nodes.length] = {id:0,name:'区域列表',open:true};
                let treeObj = $.fn.zTree.init($("#select-tree"),this.settings,this.nodes)
                console.log(treeObj);
            }).catch(error => {
                console.log(error);
            });
        },
        onClick: function (event, treeId, treeNode) {
            // parent.layer.parentName = treeNode.name;
            // parent.layer.parentId = treeNode.id;
            // parent.layer.parentIds = treeNode.parentIds;
            console.log(1111);
            parent.layer.tNode = treeNode;
            let index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        }
    },
    created:function () {

    },
    mounted:function () {
        this.initTree();
    }
})